﻿using System;
using System.Drawing;

using Storm.TextEditor.Win32;

namespace Storm.TextEditor.Drawing.GDI
{
    public class GDIPen
        : GDIObject
    {
        #region Fields

        public IntPtr hPen;

        #endregion

        #region Methods

        #region Protected

        protected override void Destroy()
        {
            if (hPen != (IntPtr)0)
                NativeGdi32Api.DeleteObject(hPen);

            base.Destroy();
            hPen = (IntPtr)0;
        }

        #endregion

        #endregion

        /// <summary>
        /// Initializes a new instance of GDIPen.
        /// </summary>
        public GDIPen(Color color, int width)
        {
            hPen = NativeGdi32Api.CreatePen(0, width, NativeUser32Api.ColorToInt(color));
            this.Create();
        }
    }
}
